package com.hq.fxh.No6UerSpace.Adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.hq.fxh.R;
import com.hq.fxh.Utils.LogUtils;
import com.hq.fxh.Utils.Tool;

import static android.R.attr.width;
import static com.hq.fxh.R.id.textView;

/**
 * /**
 *
 * @author 薛
 * @ClassName
 * @Description :
 * @Created 2017/9/19
 * @Email xlwenhao1858@sina.com
 */


public class Ladapter_JianLi_Work extends BaseAdapter {
    @Override
    public int getCount() {
        return 3;
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = convertView;

        ViewHolder viewHolder = null;
        if (view == null || !(view.getTag() instanceof ViewHolder)) {
            view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_jianli_work, null);
            viewHolder = new ViewHolder(view);
            view.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) view.getTag();
        }
        if (position == 0) {
            viewHolder.tvItemWorkJianLiWokeContent.setText("dsafsd大家撒佛寺大家哦is减肥都死接发动is见覅偶积分抵欧式我房间都我健身房iOS金佛我偶家少奋斗 ");

        }
        if (position == 1) {
            viewHolder.tvItemWorkJianLiWokeContent.setText(" 偶积分抵欧式我房间都我健身房i ");

        }
        if (position == 2) {
            viewHolder.tvItemWorkJianLiWokeContent.setText("大家撒家哦is减肥都死接发动is见覅偶积分抵欧式我房间都我健身房iOS金佛我偶家少奋dsafsd大家撒佛寺大家哦is减肥都死接佛寺大家哦is减肥都死接发动is见覅偶积分抵欧式我房间都我健身房iOS金佛我偶家少奋dsafsd大家撒佛寺大家哦is减肥都死接发动is见覅偶积分抵欧式我房间都我健身房iOS金佛我偶家少奋斗 ");

        }
   /*     Tool.getHeight(viewHolder.layoutJianLi, new Tool.MyCallBack() {
            @Override
            public void callBack(int height) {

            }
        });
*/
    //    getItemHeight(viewHolder.layoutJianLi);
        return view;
    }

    static class ViewHolder {
        protected TextView tvItemWorkJianLiGoangShi;
        protected TextView tvItemWorkJianLiTime;
        protected TextView tvItemWorkJianLiZhiWei;
        protected TextView tvItemWorkJianLiWokeContent;
        protected LinearLayout layoutJianLi;

        ViewHolder(View rootView) {
            initView(rootView);
        }

        private void initView(View rootView) {
            tvItemWorkJianLiGoangShi = (TextView) rootView.findViewById(R.id.tv_itemWork_JianLi_GoangShi);
            tvItemWorkJianLiTime = (TextView) rootView.findViewById(R.id.tv_itemWork_JianLi_Time);
            tvItemWorkJianLiZhiWei = (TextView) rootView.findViewById(R.id.tv_itemWork_JianLi_ZhiWei);
            tvItemWorkJianLiWokeContent = (TextView) rootView.findViewById(R.id.tv_itemWork_JianLi_WokeContent);
            layoutJianLi = (LinearLayout) rootView.findViewById(R.id.layout_JianLi);


        }
    }


    public void getItemHeight(View layoutJianLi) {
        //measure的参数为0即可
        layoutJianLi.measure(0, 0);
        //获取组件的宽度
        int width = layoutJianLi.getMeasuredWidth();
        //获取组件的高度
        int height = layoutJianLi.getMeasuredHeight();


        LogUtils.e(height + "、、、 高度");
    }


}
